let line
while (line = readline()) {
  let [n, ...arr] = line.split(' ').map(Number)
  if (n === 0) break
  let res = 0
  arr.forEach(v => res += v)
  print(res)
}